# -*- coding: utf-8 -*-
import unittest
from welcome_screen import WelcomeScreen
from presenter_mock import PresenterMock
from model.gamestate import *


class WelcomeTest(unittest.TestCase):
    def setUp(self):
        players = Players([Player('Andrey', []), Player('Boris', []),
                           Player('Charlie', []), Player('Dmitry', [])])
        hat = Hat(['стул', 'шапка', 'кастрюлька'])
        game_round = GameRound(20, [], '', [players.players[0],
                                            players.players[2]])
        self.presenter = PresenterMock(Phase.GAME_CONFIG)
        self.gamestate = GameState(players, hat, game_round, 0, [], None, "")

    def test_button_press(self):
        widget = WelcomeScreen(self.gamestate, self.presenter)
        widget.start_game()
        self.assertEquals(self.presenter.is_phase_changed, True)

    def test_new_game(self):
        self.presenter = PresenterMock(Phase.GAME_CONFIG)
        self.game_state = GameState(Players([None, None]), None, None, None,
                                    None, None, None)
        widget = WelcomeScreen(self.game_state, self.presenter)
        widget.start_game()
        self.assertEquals(widget.gamestate, None)

if __name__ == '__main__':
    unittest.main()
